home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / fido / fz104.lha / rexx / UX.rexx < prev   
OS/2 REXX Batch file  |  1992-06-01  |  3KB  |  108 lines

  1. /*
  2.  
  3.     UX.rexx - Universal extract script
  4.  
  5.     revision 2.1, 23-Dec-91 23:32:21, Peer Hasselmeyer
  6.             (Thanks to Robert Williamson for the suggestion of
  7.              looking for the deepest archive signature first)
  8.     revision 2.0, 20-Aug-91 18:14:08, Peer Hasselmeyer
  9.  
  10.  
  11.     Supports: Arc, Zoo, LhArc, LHA, Zip, Arj
  12.  
  13.  
  14. ---------------------- Configuration Section ------------------------- */
  15.  
  16. packer.arc.x    = "PKxArc"
  17. packer.arc.l    = "PKxArc -v"
  18. packer.arc.a    = "Arc a"
  19. packer.arc.t    = "PKxArc -t"
  20.  
  21. packer.zoo.x    = "zoo x"
  22. packer.zoo.l    = "zoo l"
  23. packer.zoo.a    = "zoo a"
  24. packer.zoo.t    = "zoo t"
  25.  
  26. packer.lharc.x    = "lha x"
  27. packer.lharc.l    = "lha l"
  28. packer.lharc.a    = "lha a"
  29. packer.lharc.t    = "lha t"
  30.  
  31. /* packer.lha.x    = "lha x"
  32.  * packer.lha.l    = "lha l"
  33.  * packer.lha.a    = "lha a"
  34.  * packer.lha.t    = "lha t"
  35.  */
  36. packer.zip.x    = "unzip x"
  37. packer.zip.l    = "unzip v"
  38. packer.zip.a    = "zip a"
  39. packer.zip.t    = "unzip t"
  40.  
  41. packer.arj.x    = "unarj x"
  42. packer.arj.l    = "unarj l"
  43. packer.arj.a    = ""
  44. packer.arj.t    = "unarj t"
  45.  
  46. /*----------------------------------------------------------------------*/
  47.  
  48. parse arg option archive flist
  49. upper option
  50.  
  51. select
  52.     when option = "V" then option = "L"
  53.     when option = "L" then option = "L"
  54.     when option = "E" then option = "X"
  55.     when option = "X" then option = "X"
  56.     when option = "A" then option = "A"
  57.     when option = "T" then option = "T"
  58.     otherwise do
  59.     say "Usage: UX <command> <archive> [<list of files>]"
  60.     say "   command may be one of the following:"
  61.     say "        V,L  : list contents of archive"
  62.     say "        E,X  : extract files from archive"
  63.     say "        A    : add files to archive"
  64.     say "        T    : test files in archive"
  65.     exit 1
  66.     end
  67.     end
  68.  
  69. if ~open(file, archive, r) then do
  70.     say 'Couldn''t access archive "' || archive || '" !'
  71.     say
  72.     exit 20
  73.     end
  74.  
  75. readin = readch(file, 6)
  76. call close file
  77.  
  78. if length(readin) < 6 then do
  79.     say 'Archive "' || archive || '" is too short !'
  80.     say
  81.     exit 20
  82.     end
  83.  
  84. select
  85.     when left(readin,3) = "ZOO" then method = "ZOO"
  86.     /* when substr(readin,3,4) = "-lh5" then method = "LHA" */
  87.     when substr(readin,3,3) = "-lh" then method = "LHARC"
  88.     when left(readin,2) = "PK" then method = "ZIP"
  89.     when left(readin,2) = "60ea"x then method = "ARJ"
  90.     when left(readin,1) = "1a"x then method = "ARC"
  91.     otherwise do
  92.     say 'Can''t handle archive "' || archive || '" !'
  93.     say
  94.     exit 20
  95.     end
  96.     end
  97.  
  98. if packer.method.option = "" then do
  99.     say "Can't do that !"
  100.     say
  101.     exit 20
  102.     end
  103.  
  104. address command packer.method.option archive flist
  105.  
  106. exit rc
  107.  
  108.